
package com.lzx.iteam.contactssearch;


import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.ListView;
import com.lzx.iteam.widget.AmazingListView;
import com.lzx.iteam.CloudDialerActivity;


public abstract class ContactsSearchList implements View.OnClickListener, View.OnKeyListener,
        OnScrollListener{
    
    private static final String TAG = "ContactsSearchList";

    protected CloudDialerActivity mActivity;

    protected /*AmazingListView*/ListView mListView;

    protected Context mContext;

    protected Resources mResources;
    
    protected LayoutInflater mInflater;
    
    public SearchStatus mStatus = SearchStatus.ENUM_SEARCH_NONE;

    public ContactsSearchList(CloudDialerActivity activity, ListView listView) {
        mListView = /*(AmazingListView)*/ listView;
        mActivity = activity;
        mInflater = mActivity.getLayoutInflater();

        mContext = activity;
        mResources = mContext.getResources();
    }

    public void refresh(String keyword, boolean ifShowPeopleNoPhone) {
        mStatus = SearchStatus.ENUM_SEARCH_BEGIN;
        mListView.setVisibility(View.VISIBLE);
    }
    
    public void refreshGroup(String groupId,String keyword, boolean ifShowPeopleNoPhone)
    {
        mStatus = SearchStatus.ENUM_SEARCH_BEGIN;
        mListView.setVisibility(View.VISIBLE);
    }
    
    
    public void searchOver() {
        mStatus = SearchStatus.ENUM_SEARCH_OVER;
    }
    
    public void clear() {
    }

    public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
            int totalItemCount) {
    }


    public void onClick(View view) {
        return;
    }


    public boolean onKey(View view, int keyCode, KeyEvent event) {
        return false;
    }

    public boolean onKeyUp(int keyCode, KeyEvent event) {
        return false;
    }

    public boolean onKeyDown(int keyCode, KeyEvent event) {
        return false;
    }

    public void onPause() {
    }

    public void onResume() {
    }

    public void onDestroy() {
        mResources = null;
        mContext = null;
        mActivity = null;
    }

    public Activity getActivity() {
        return mActivity;
    }
    
    public enum SearchStatus{
        ENUM_SEARCH_NONE,
        ENUM_SEARCH_BEGIN,
        ENUM_SEARCH_OVER,
    }

}
